package cn.xyinping.pay.domain;

import cn.xyinping.basic.domain.BasicDomain;
import com.alipay.easysdk.kernel.Config;
import lombok.Data;

/**
 * @author 27266
 * @desrciption 支付宝配置表
 * @date 2021/11/8
 */
@Data
public class AlipayInfo extends BasicDomain {
    private Long shop_id;
    private String shopName;
    // 支付宝appid
    private String appid;
    // 应用私钥
    private String merchant_private_key;
    // 支付宝公钥
    private String alipay_public_key;
    // https协议
    private String protocol;
    // 支付宝网关
    private String gatewayHost;
    // 签名类型
    private String signType;
    // 异步回调
    private String notifyUrl;
    // 同步回调
    private String returnUrl;

    //创建支付宝的配置对象
    public Config getOptions() {
        Config config = new Config();
        config.protocol = this.protocol;
        config.gatewayHost = this.gatewayHost;
        config.signType = this.signType;
        config.appId = this.appid;
        // 为避免私钥随源码泄露，推荐从文件中读取私钥字符串而不是写入源码中
        config.merchantPrivateKey = this.merchant_private_key;
        //可设置异步通知接收服务地址（可选）
        config.notifyUrl = this.notifyUrl;
        //少了一个
        config.alipayPublicKey =this.alipay_public_key;
        return config;
    }


}
